# $Id: PKGBUILD 184443 2013-05-06 19:40:02Z foutrelis $
# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=vice
pkgver=2.4
pkgrel=3
pkgdesc="The Versatile Commodore 8-bit Emulator"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.viceteam.org/"
depends=('alsa-lib' 'giflib' 'libxxf86vm' 'vte' 'libnet' 'libpcap')
makedepends=('xorg-font-utils')
options=('!makeflags')
install=vice.install
source=("http://downloads.sourceforge.net/project/vice-emu/releases/${pkgname}-${pkgver}.tar.gz"
        'vice-2.4-x11video.patch'
        'vice-2.4-no-fc-cache-no-lib64.patch'
        'vice-2.4-notexi-notxt.patch'
        'vice-2.4-zlib-1.2.7.patch')
md5sums=('b017647a0c159bbe43cdb81762d1c577'
         '99931efcb779734c9df069e94f0b38a5'
         'b0d1392664decd3169740baf90661710'
         '877f93db1550ea81386aae7c3b578442'
         '9d9f62f05a967a5926df496e86404148')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  patch -Np1 -i "${srcdir}/vice-2.4-x11video.patch"
  patch -Np1 -i "${srcdir}/vice-2.4-no-fc-cache-no-lib64.patch"
  patch -Np1 -i "${srcdir}/vice-2.4-notexi-notxt.patch"
  patch -Np1 -i "${srcdir}/vice-2.4-zlib-1.2.7.patch"

  sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.in

  autoreconf -vi
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  ./configure --prefix=/usr \
              --enable-ethernet \
              --with-alsa \
              --enable-fullscreen \
              --enable-gnomeui \
              --disable-ffmpeg
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make DESTDIR="${pkgdir}" realdocdir="/usr/share/doc/vice" install
  ln -s /usr/share/doc/vice "${pkgdir}/usr/lib/vice/doc"
}
